#ifndef  mid_key_h_
#define  mid_key_h_
#include "hal.h"



#define   KEYBUFMAXNUM  4

#define   KEYMAX        4

#define   KEYUpMAX      10


typedef  struct  structkeyVal{
    uint8_t  val;
	  uint8_t  state;
		uint8_t  cnt;

} strkeyVal;

typedef  struct  structkey{
    uint8_t  keyWptr;
	  uint8_t  keyRptr;
	  strkeyVal  keyBuf[KEYBUFMAXNUM];
	  uint8_t  linenum;
		uint8_t  KeyTemp[KEYMAX];
	  uint8_t  KeyCnt;
	  uint8_t  UpCnt;
	  uint8_t  ful;

	
} strkey;

void mid_KeyInit(void);
void Mid_ScanKey(void);










#define   LINE1_HIGH()    Gpio_SetIO(GpioPortB, GpioPin3)
#define   LINE1_LOW()     Gpio_ClrIO(GpioPortB, GpioPin3)

#define   LINE2_HIGH()    Gpio_SetIO(GpioPortB, GpioPin4)
#define   LINE2_LOW()     Gpio_ClrIO(GpioPortB, GpioPin4)

#define   LINE3_HIGH()    Gpio_SetIO(GpioPortB, GpioPin5)
#define   LINE3_LOW()     Gpio_ClrIO(GpioPortB, GpioPin5)

#define   LINE4_HIGH()    Gpio_SetIO(GpioPortB, GpioPin6)
#define   LINE4_LOW()     Gpio_ClrIO(GpioPortB, GpioPin6)

#define   LINE5_HIGH()    Gpio_SetIO(GpioPortB, GpioPin7)
#define   LINE5_LOW()     Gpio_ClrIO(GpioPortB, GpioPin7)


#endif







